#ifndef GAME_MAP_H
#define GAME_MAP_H

#include "BaseGameEntity.h"
#include <vector>
#include "Grid.h"
#include "CellSpacePartition.h"
#include "Vector2D.h"
#include "GraphTypes.h"
#include "GraphNode.h"
#include "GraphEdge.h"
#include "Minimap.h"

// An instance of this class will contain all the information on a map in the game. Things such as all the characters
// buildings, items or other BaseGameEntities on the map, the maps graphic information, it's CellSpacePartition, 
// the navigation graph, and more if I think of anything we need. 


class GameMap 
{
private:
	typedef SparseGraph<NavGraphNode<void*>, GraphEdge> NavGraph;

	// The navigation graph that characters use to get arround.
	NavGraph* m_pNavGraph;  
	
	// The holds the graphics information on the map.
	Grid m_Grid; 
	
	// The partition that divides the map
	CellSpacePartition m_Partition; 
	
	// Defines the bounding dimensions of the entire map. 
	SDL_Rect MapBounds;

	Minimap m_Minimap;

public:

	GameMap(string mapfile);
	~GameMap();

	void RenderGrid();
	void RenderMinimap();

	void AddEntity(BaseGameEntity* anEntity); 
	void UpdateMinimapEntity(int ID, const Vector2D& position);
	

	vector<BaseGameEntity*> GetNeighbors(BaseGameEntity* anEntity, double QueryRadius);
	SparseGraph<NavGraphNode<void*>, GraphEdge>* GetGraph() {return m_pNavGraph;}

	int MapWidth() {return m_Grid.Width();}
	int MapHeight() {return m_Grid.Height();}

	CellSpacePartition& GetPartition() {return m_Partition;}
	Minimap& Minimap() {return m_Minimap;}
	Grid& GetGrid() {return m_Grid;}
};

#endif